Skip to main content

Environment Variables for Micro-Service Applications

This document provides a brief description of the environment variables that are used by the micro-service applications developed and maintained by the Department of Information & Technology (DIT). These variables are used to configure various aspects of the applications, such as database connections, cloud storage access, message queue settings, etc. The environment variables follow a standard naming convention that consists of two parts: the prefix and the suffix. The prefix indicates the component or service that the variable belongs to, and the suffix indicates the specific parameter or attribute that the variable represents. For example, DATABASE__HOST is an environment variable that specifies the host name of the database server for the application.

The following table lists the environment variables that are common to all DIT micro-service applications, along with their descriptions.

Environment VariableDescription
CAS__URLURL for the Central Authentication Service (CAS)
CAS__M2M_CLIENT_IDClient ID for machine-to-machine authentication with the CAS
CAS__M2M_CLIENT_SECRETClient secret for machine-to-machine authentication with the CAS
DATABASE__CONNECTION_STRINGThe connection string of database server
DATABASE__URLThe URL format for the connection string of database server
DATABASE__HOSTThe host name or IP address of the database server
DATABASE__USERNAMEThe username for accessing the database
DATABASE__PASSWORDThe password for accessing the database
DATABASE__NAMEThe name of the database
DATABASE__PORTThe port number of the database server
S3__ENDPOINTThe endpoint URL of the S3 bucket
S3__ACCESS_KEY_IDThe access key ID for accessing the S3 bucket
S3__SECRET_ACCESS_KEYThe secret access key for accessing the S3 bucket
S3__SELF_BUCKETThe name of the S3 bucket used for storing self-related files
S3__UPLOADS_API_BUCKETThe name of the S3 bucket used for storing uploaded files via Uploads API
SIDEKIQ__USERNAMEThe username for accessing the Sidekiq web interface
SIDEKIQ__PASSWORDThe password for accessing the Sidekiq web interface
SIDEKIQ__REDIS_URLThe URL of the redis database used by the Sidekiq web interface
REDIS__URLThe URL format for the connection string of redis database server
REDIS__CONNECTION_STRINGThe connection string of redis database server
REDIS_SENTINEL__HOSTThe host name or IP address of the Redis Sentinel server
REDIS_SENTINEL__PORTThe port number of the Redis Sentinel server
REDIS_SENTINEL__PASSWORDThe password for accessing the Redis Sentinel server
REDIS_SENTINEL__MASTERThe name of the Redis Sentinel master
REDIS__PASSWORDThe password for accessing the Redis server
REDIS__DBThe number of the Redis database
SIDEKIQ__REDIS_DBThe number of the Redis database for Sidekiq
SENTRY__DSNThe data source name (DSN) for Sentry error tracking
SENTRY__TRACE_RATEThe sampling rate for Sentry performance tracing
SENTRY__ENVIRONMENTThe environment name for Sentry error tracking
GATEWAY__CERTIFICATEThe certificate file for accessing the gateway service
RABBITMQ__URLThe URL the RabbitMQ server
RABBITMQ__HOSTThe host name or IP address of the RabbitMQ server
RABBITMQ__PORTThe port number of the RabbitMQ server
RABBITMQ__VHOSTThe virtual host name of the RabbitMQ server
RABBITMQ__USERNAMEThe username for accessing the RabbitMQ server
RABBITMQ__PASSWORDThe password for accessing the RabbitMQ server
RABBITMQ__EXCHANGE_NAMEThe name of the exchange for RabbitMQ server

Environment Variables for Micro-Service Applications​

  1. Use double underscores (__) to separate words in the variable name.
  2. Use all uppercase letters for the variable name.
  3. Use descriptive names for the variable that indicate their purpose or usage.
  4. Use consistent naming across all microservice applications developed by DIT.
  5. Store environment variables securely, using an encrypted secrets store, such as HashiCorp Vault or Amazon Secrets Manager.
  6. Avoid hard-coding sensitive information, such as passwords or API keys, in the code.

Conclusion​

The standard naming convention for environment variables used by microservice applications developed and maintained by the Department of Information & Technology (DIT) has been outlined in this document. Following these guidelines will ensure consistency and clarity across all microservice applications developed by DIT.